CyberStore Cart Web Service
MethodAddItemToCartByStockCode
CyberStore Cart Web Service > All Operations Resource Group : AddItemToCartByStockCode (Method)
Description
Adds an Item, by StockCode, to the current shopping cart in a specified Quantity using the Preferred Unit of Measure.
Remarks

The AddItemToCartByStockCode operation adds a single Item to the current Shopper's shopping cart at the Customer's price for that Item in the quantity and unit of measure type specified.

To utilize the operation use the CyberStore global JavaScript function MakeAJAXCall.

The result will be returned as a string in the form of a JSON object.

Request (AddItemToCartByStockCodeSoapIn)

The request body is of type AddItemToCartByStockCode.

Request Body Parameters

NameDescriptionData Type
The StockCode of the Item to add to the cart.xml:string
The quantity of the Item to add to the cart.xml:int

The type of the unit of measure.

Valid options are as follows:

  • Stocking: "stocking", "STK", "S" or 1
  • Alternate: "alternate", "ALT", "A" or 2
  • Other: "other", "OTH", "O" or 3
  • Preferred: "preferred", "PREF", "P" or 0

    or
  • Specify the UOM by the unit label text prefixed with an @ sign. For example "@EA"

xml:anyType

An object with optional parameters. Introduced in v2.21.

Available parameters

  • Warehouse - a valid warehouse code, which when sent will request the line be shipped from the specified warehouse. Assumes the item is stocked in the specified warehouse.

xml:string
Example
The following example shows how to perform the web operation in CyberStore.
// Example: Add to the Shopping Cart  
//      the Item with Stock Code = A100 
//      with a quantity of 1
//      in the Preferred unit of measure
// then send the response to the browser console

MakeAJAXCall("Cart.AddItemToCartByStockCode", {
    StockCode: 'A100',
    Qty: 1,
    UOM: 'preferred'
}, console.log);
200 Response (AddItemToCartByStockCodeSoapOut)

The response body is of type AddItemToCartByStockCodeResponse.

Response Body Parameters

NameDescriptionData Type

A string value containing a JSON object.

// Example 1: Successful add to cart response

{
    "Success": true,
    "CartOrderDetail_ID": 1007,
    "Message": "There are 2 items in the Shopping Cart.",
    "Data": {
        "ItemCount": 2,
        "SubTotalAmount": 860.3,
        "Weight": 20.0,
        "Volume": 0.6,
        "LastUpdated": "2022-03-29T16:06:49.86",
        "SubTotal": "$860.30 ",
        "Detail": [{
            "Row": 1,
            "ID": 1007,
            "Item_ID": 579,
            "Parent_ID": -1,
            "StockCode": "A100",
            "Description": "15 Speed Mountain Bike Boys",
            "Quantity": 2,
            "UOM": "EA",
            "UnitType": 1,
            "DefaultPriceAmount": 560.0,
            "CustomerPriceAmount": 559.0,
            "DiscountPriceAmount": 477.945,
            "WebPriceAmount": 430.1505,
            "TotalPriceAmount": 860.3,
            "UnitWeight": 10.0,
            "UnitVolume": 0.3,
            "IsBackordered": false,
            "Warehouse": "",
            "LastUpdated": "2022-03-29T16:40:37.333",
            "URL": "/ECommerce/product/a100/15-speed-mountain-bike-boys",
            "Photo": "/Ecommerce/site/images/Photo1/A100.jpg",
            "DefaultPrice": "$560.00 ",
            "CustomerPrice": "$559.00 ",
            "DiscountPrice": "$477.945 ",
            "WebPrice": "$430.151 ",
            "TotalPrice": "$860.30 "
        }]
    },
    "Result": {
        "Success": true,
        "Message": "There are 2 items in the Shopping Cart.",
        "ElapsedTime": "51 ms"
    }
}

// Example 2: Error add to cart response

{
    "Success": false,
    "CartOrderDetail_ID": 0,
    "Message": "The requested item was not found, and can not be added to the cart at this time.\r\n There are 2 items in the Shopping Cart.",
    "Data": {
        "ItemCount": 2,
        "SubTotalAmount": 860.3,
        "Weight": 20.0,
        "Volume": 0.6,
        "LastUpdated": "2022-03-29T16:06:49.86",
        "SubTotal": "$860.30 ",
        "Detail": [{
            "Row": 1,
            "ID": 1007,
            "Item_ID": 579,
            "Parent_ID": -1,
            "StockCode": "A100",
            "Description": "15 Speed Mountain Bike Boys",
            "Quantity": 2,
            "UOM": "EA",
            "UnitType": 1,
            "DefaultPriceAmount": 560.0,
            "CustomerPriceAmount": 559.0,
            "DiscountPriceAmount": 477.945,
            "WebPriceAmount": 430.1505,
            "TotalPriceAmount": 860.3,
            "UnitWeight": 10.0,
            "UnitVolume": 0.3,
            "IsBackordered": false,
            "Warehouse": "",
            "LastUpdated": "2022-03-29T16:40:37.333",
            "URL": "/ECommerce/product/a100/15-speed-mountain-bike-boys",
            "Photo": "/Ecommerce/site/images/Photo1/A100.jpg",
            "DefaultPrice": "$560.00 ",
            "CustomerPrice": "$559.00 ",
            "DiscountPrice": "$477.945 ",
            "WebPrice": "$430.151 ",
            "TotalPrice": "$860.30 "
        }]
    },
    "Result": {
        "Success": false,
        "Message": "The requested item was not found, and can not be added to the cart at this time.\r\n There are 2 items in the Shopping Cart.",
        "ElapsedTime": "7 ms"
    }
}

 

xml:string
See Also
All Operations Resource GroupCyberStore Cart Web Service